package cn.webrx;

public class T4 {
    public static void main(String[] args) {
        //定时关机
        new Thread(()->{
            int m = 0;
            System.out.printf("程序启动(%d分钟后关机)....%n%n",m);
            System.out.printf("%tT%n",System.currentTimeMillis());
            long end = System.currentTimeMillis()+(m*60*1000);
            while(true){
                if(System.currentTimeMillis() >= end){
                    System.out.printf("%tT%n",System.currentTimeMillis());
                    System.out.println("关机....");
                    //Runtime run = Runtime.getRuntime();
                    //run.exec("cmd /k shutdown /s /t 0");  linux shutdown -h now
                    System.out.println(System.getProperty("os.name"));
                    break;
                }
            }
        }).start();
    }
}
